<template>
	<view>
		<view class="allbanner" style="position: relative;">
			<view class="bannercenter flexcolumn">
				<view class="bannerimgtext">
					<image src="@/static/image/system/f7xn.png" mode="" class=""></image>
				</view>
				<view class="bannertext3 margin_top">常用工具</view>
			</view>
			<image :src="topimg" mode=""></image>
		</view>
		<view class="" style="padding: 45rpx;">
			<view class="flexbetween flex_wrap">
				<view class="cyicon margin_top" v-for="item in cygj_list" @click="yizygy(item)" :key="item.id">
					<image :src="item.image1_text" mode=""></image>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				topimg: "",
				cygj_list:[],
			}
		},
		onShow() {
			this.getbanner() //轮播
			this.getcygj()//常用工具
		},
		methods: {
			yizygy(item) {
				uni.navigateToMiniProgram({
					// appid  写你要跳转的小程序的 appid
					appId: item.wechat_appid,
					// 路径写  src下的路径,假如你跳转的是pages下的页面,就可以写pages/index
					path: item.wechat_path,
					extraData: {
						// 'type': 'out'
					},
					// 这个不写的话会显示开发环境,不能正常跳转,写上就能正常跳转了
					envVersion: 'release',
					success(res) {
						// 打开成功
						console.log("跳转成功");
						// uni.showToast({
						// 	title: '跳转成功'
						// })
					},
					fail(err) {
						// 打开失败/取消
						console.log("跳转不成功");
						// uni.showToast({
						// 	title: '跳转不成功'
						// })
					}
				})
			},
			getcygj(){
				httpRequest.request('/api/index/cygjIndex', 'GET', {
					Page:1,
					limit:1000
				}, false, false, true).then(res => {
					this.cygj_list = res.data.data
				})
			},
			getbanner() {
				httpRequest.request('/api/index/getAdvertiseList', 'POST', {
					advertise_position_id: 9,
					is_more: 2
				}, false, false, true).then(res => {
					this.topimg = res.data.image_text
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	
	.cyicon {
		width: 317rpx;
		height: 121rpx;
		border-radius: 10rpx;
		image {
			border-radius: 10rpx;
			width: 100%;
			height: 100%;
		}
	}
</style>